home *** CD-ROM | disk | FTP | other *** search
- ;FILE :FINDDATA.ASM
- ;USEAGE :call finddata(FILENAME$,FILELEN&,MO%,DY%,YR%,HR%,MN%,FILEATTR%)
- ; 22 1e 1a 16 12 0e 0a 06
- ;Findata returns file data results from FINDFILE or FINDNEXT into variables
-
- finddata segment
- assume cs:finddata
- push bp ;Standard stuff.
- mov bp,sp
- push ds
-
- mov dx,ds:[0] ;Current string segment.
- push dx
- pop ds ;THERE! String's segment is ds.
-
- les di,[bp+022h] ;String descripter's pointer
- mov si,es:[di+2] ;offset of string in DS seg.
- mov cx,es:[di] ;Length of string.. should always be 12.
-
- mov ah,02fh ;Get current DTA (Should have our filename!)
- int 021h ;MSDOS. ES:BX should now be DTA.
-
- add bx,21 ;skip over reserved area.
- ;First do filename.
- mov di,bx
- movenm: mov al,es:[di+9] ;+9 to skip over time/date info..
- cmp al,'.' ;are we at period yet?
- jne goahead ;Nope
- cmp cx,4 ;are we in 9th pos yet?
- jne goahd2 ;If we are, go ahead and let dot go through
- goahead:cmp al,0 ;end of file?
- jne goahd3 ;nope
- goahd2: mov al,' ' ;To early! let's just put a space in it's place.
- dec di
- goahd3: mov [si],al
- inc di
- inc si
- loop movenm
- push es ;Current DTA segment
- pop ds ;Set [DS] to DTA segment.
-
- ;Now do attribute.
- mov di,bx ;[DI] = offset.
- les si,[bp+06h] ;Address of Attribute integer
- mov al,[di] ;Attribute
- mov ah,0
- mov es:[si],ax ;Store attribute
- ;Now do time
- les si,[bp+0ah] ;Address of minutes integer.
- mov ax,[di]+1 ;Hours/minutes/even secs of file.
- mov cl,5 ;rotate 5 times folks
- shr ax,cl
- push ax ;Save it, still need to do hours
- and ax,111111b ;Mask off, only save minutes
- mov es:[si],ax ;Store minutes!
- pop ax
- inc cl ;rotate 6 times folks
- shr ax,cl ;Move it over rover.
- les si,[bp+0eh] ;Address of hours integer
- mov es:[si],ax ;Store hours.
- ;Now do date.
- les si,[bp+016h] ;Address of days.
- mov ax,[di]+3 ;Date word.
- push ax ;save it for month/year yet.
- and ax,11111b ;Mask of month/year
- mov es:[si],ax ;store day
- pop ax
- dec cl ;Rotate 5 times folks
- shr ax,cl ;Rotate days off the world
- push ax
- les si,[bp+01ah] ;Address of month integer.
- and ax,1111b ;Mask off year.
- mov es:[si],ax
- pop ax
- dec cl ;Rotate 4 times folks
- shr ax,cl ;Year should now be low bits.
- add ax,80 ;Let's makeit 87
- les si,[bp+012h] ;Address of year integer
- mov es:[si],ax
- ;Now do filesize.
- les si,[bp+01eh] ;Address of filesize double int.
- mov ax,[di]+5 ;Low word of filesize in DTA
- mov es:[si],ax ;Store in low word of filesize doubleint.
- mov ax,[di]+7 ;Hi word of fs.
- mov es:[si+2],ax ;Store in hi word of fs doub int.
- ;DONE! now restore ds,bp and return
- pop ds ;Restore DS
- pop bp ;Restore BP
- finddata ends
- end
-
-